
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
    
        .box1{
           background-color: rgba(0, 0, 0, 0.3);
        }

        .box2{
            opacity: 0.5;  /*直接设置背景效果，比rgba更厉害一点*/
            
     
        }
    </style>
</head>
<body>
    <div class="box1"><img src="../img/img1.jpg" alt=""></div>
    <div class="box2"><img src="../img/img3.jpeg" alt=""></div>
</body>
</html>